//  this library.
import 'package:hktk_app/ienum/package/payment_type_enum.dart';

/// 系统支付单相关模型
class PaymentModel {
  String? createdTime;
  String? modifyTime;
  String? createdBy;
  String? modifyBy;
  int? id;
  PaymentTypeEnum? paymentType;
  PaymentStatusEnum? paymentStatus;
  String? orderId;
  int? paymentAmount;
  DeviceTypeEnum? deviceType;
  String? payTime;
  String? refundTime;
  String? payUserId;
  String? mode;
  String? serialNumber;
  int? paymentAmountDecimal;
  String? orderSn;

  PaymentModel({
    this.createdTime,
    this.modifyTime,
    this.createdBy,
    this.modifyBy,
    this.id,
    this.paymentType,
    this.paymentStatus,
    this.orderId,
    this.paymentAmount,
    this.deviceType,
    this.payTime,
    this.refundTime,
    this.payUserId,
    this.mode,
    this.serialNumber,
    this.paymentAmountDecimal,
    this.orderSn,
  });

  PaymentModel.fromJson(Map<String, dynamic> json) {
    createdTime = json['createdTime'];
    modifyTime = json['modifyTime'];
    createdBy = json['createdBy'];
    modifyBy = json['modifyBy'];
    id = json['id'];
    paymentType = json['paymentType'] != null
        ? PaymentTypeEnum.getTypeEnum(json['paymentType'])
        : null;
    paymentStatus = json['paymentStatus'] != null
        ? PaymentStatusEnum.getTypeEnum(json["paymentStatus"])
        : null;
    orderId = json['orderId'];
    paymentAmount = json['paymentAmount'];
    deviceType = json['deviceType'] != null
        ? DeviceTypeEnum.getTypeEnum(json["deviceType"])
        : null;
    payTime = json['payTime'];
    refundTime = json['refundTime'];
    payUserId = json['payUserId'];
    mode = json['mode'];
    serialNumber = json['serialNumber'];
    paymentAmountDecimal = json['paymentAmountDecimal'];
    orderSn = json['orderSn'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['createdTime'] = createdTime;
    data['modifyTime'] = modifyTime;
    data['createdBy'] = createdBy;
    data['modifyBy'] = modifyBy;
    data['id'] = id;
    if (paymentType != null) {
      data['paymentType'] = paymentType!.name;
    }
    if (paymentStatus != null) {
      data['paymentStatus'] = paymentStatus!.name;
    }
    data['orderId'] = orderId;
    data['paymentAmount'] = paymentAmount;
    if (deviceType != null) {
      data['deviceType'] = deviceType!.name;
    }
    data['payTime'] = payTime;
    data['refundTime'] = refundTime;
    data['payUserId'] = payUserId;
    data['mode'] = mode;
    data['serialNumber'] = serialNumber;
    data['paymentAmountDecimal'] = paymentAmountDecimal;
    data['orderSn'] = orderSn;
    return data;
  }
}
